<%= form_for @operatingsystem do |f| %>
  <%= base_errors_for @operatingsystem %>
  <ul class="nav nav-tabs" data-tabs="tabs">
    <li class="active"><a href="#primary" data-toggle="tab"><%= _("Operating System") %></a></li>
    <% if SETTINGS[:unattended] %>
      <li><a href="#ptable" data-toggle="tab"><%= _("Partition Table") %></a></li>
      <li><a href="#media" data-toggle="tab"><%= _("Installation Media") %></a></li>
      <li><a href="#templates" data-toggle="tab"><%= _("Templates") %></a></li>
    <% end -%>
    <% if authorized_for(:controller => "host_editing", :action => "view_params") %>
      <li><a href="#params" data-toggle="tab" id="params-tab"><%= _("Parameters") %></a></li>
    <% end %>
  </ul>

  <div class="tab-content">

    <div class="tab-pane active" id="primary">

      <%= text_f f, :name, :help_inline => _("OS name from facter; e.g. RedHat") %>
      <%= text_f f, :major, :help_inline => _("OS major version from facter; e.g. 7"), :class => "col-md-2" %>
      <%= text_f f, :minor, :help_inline => _("OS minor version from facter; e.g. 0 or 6.1810 (CentOS scheme)"), :class => "col-md-2" %>
      <%= text_f f, :description, :help_inline => _("OS friendly name; e.g. RHEL 6.5") %>
      <%= select_f f, :family, Operatingsystem.families_as_collection, :value, :name, { :include_blank => _("Choose a family") }, { :label => _("Family"), :onchange => 'show_release(this);' } %>
      <div id="release_name" <%= display?(!@operatingsystem.use_release_name?) %>>
        <%= text_f f, :release_name, :help_inline => _("e.g. karmic, lucid, hw0910 etc") %>
      </div>
      <%= select_f f, :password_hash, PasswordCrypt::ALGORITHMS.keys, :to_s, :to_s, {}, { :label => _("Root Password Hash"), :help_inline => _("Hash function to use. Change takes effect for new or updated hosts.")} %>
      <%= multiple_checkboxes f, :architectures, @operatingsystem, Architecture, :label => _("Architectures") %>
    </div>

    <% if SETTINGS[:unattended] %>
      <%= render('template_defaults', :f => f) %>

      <div class="tab-pane" id="ptable">
        <%= multiple_checkboxes f, :ptables, @operatingsystem, os_habtm_family(Ptable, f.object), :label => _("Partition Tables") %>
      </div>
      <div class="tab-pane" id="media">
        <%= multiple_checkboxes f, :media, @operatingsystem,   os_habtm_family(Medium, f.object), :label => _("Installation Media") %>
      </div>
    <% end %>
    <% if authorized_for(:controller => "host_editing", :action => "view_params") %>
      <div class="tab-pane" id="params">
        <%= render "common_parameters/parameters", { :f => f, :type => :os_parameters } %>
      </div>
    <% end %>
  </div>

  <%= submit_or_cancel f %>
<% end %>
